//part1:c07:7.27:Screen.h
#ifndef SCREEN_H__
#define SCREEN_H__
#include <iostream>
class Screen
{
public:
    Screen() = default;
    Screen(unsigned ht, unsigned wd) : height(ht), width(wd),
        contents(ht * wd, ' '){}
    Screen(unsigned ht, unsigned wd, char c)
     :height(ht), width(wd), contents(ht * wd, c){}
    Screen &move(unsigned r, unsigned c)
    {
        cursor = r * width + c;
        return *this;
    }

    Screen& set(char ch)
    {
        contents[cursor] = ch;
        return *this;
    }
    Screen& set(unsigned r, unsigned c, char ch)
    {
        contents[r * width + c] = ch;
        return *this;
    }

    Screen& display()
    {
        std::cout << contents;
        return *this;
    }
  private:
    unsigned height = 0;
    unsigned width = 0;
    unsigned cursor = 0;
    std::string contents;
};
#endif
